package br.ufla.pgcc.oomeasures.astvisitors;

import java.util.List;

import org.eclipse.jdt.core.dom.ASTVisitor;
import org.eclipse.jdt.core.dom.Comment;
import org.eclipse.jdt.core.dom.CompilationUnit;

public class ClassLinesOfCodeVisitor extends ASTVisitor {
	private int numberOfLinesOfCode = 0;
	
	@SuppressWarnings("unchecked")
	public boolean visit(CompilationUnit unit) {
		List<Comment> com = unit.getCommentList();
		for (Comment c : com) {
			c.delete();
		}
		numberOfLinesOfCode = unit.toString().split("\n").length;
		return false;
	}

	public int getNumberOfLinesOfCode(){
		return numberOfLinesOfCode;
	}	
} 